package cn.daniellee.plugin.ce.storage;

import cn.daniellee.plugin.ce.CraftEconomy;
import cn.daniellee.plugin.ce.model.PlayerData;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public abstract class Storage {

	Map<String, PlayerData> allPlayerDataCache = new HashMap<>();

	public Map<String, PlayerData> getAllPlayerDataCache() {
		return allPlayerDataCache;
	}

	public PlayerData getPlayerData(String targetPlayer) {
		PlayerData playerData = allPlayerDataCache.get(targetPlayer);
		if (playerData == null) playerData = refreshPlayerData(targetPlayer);
		return playerData;
	}

	public abstract boolean initialize();

	public abstract PlayerData refreshPlayerData(String targetPlayer);

	public abstract void updatePlayerData(String targetPlayer, String column, Object value);

	public abstract List<PlayerData> getAllPlayerData();

}
